home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 163_02 / smallcv2.doc < prev    next >
Text File  |  1991-01-05  |  23KB  |  464 lines

  1. .* My thanks to Dick Dievendorff for fixing up this file to format with
  2. .* GML.  Now, if someone could do the same with SCLIB DOC . . .
  3. :gdoc.
  4. :frontm.
  5. :titlep.
  6. :title.Small-c Version 2.0
  7. :title.for the IBM Personal Computer
  8. :title.Release 1.01
  9. :date.
  10. :author.Daniel R. Hicks
  11. :address.
  12. :aline.
  13. :aline.RCH38DB(HICKS)
  14. :eaddress.
  15. :etitlep.
  16. :preface.
  17. :p.Portions of Small-c code Copyright 1982 by J. E. Hendrix.
  18. :p.Converted to the IBM Personal Computer by D. R. Hicks.
  19. :p.This document was developed entirely by D. R. Hicks, and is
  20. :hp1.not:ehp1. copyrighted.
  21. :body.
  22. :h1.Why Small-c?
  23. :p.
  24. Why bother with a limited version of the C programming language when
  25. complete versions of the language are available?  The main reason is
  26. price.  The cheapest "full" C implementations run about $75, and
  27. prices increase from there up to the $500 range.  Small-c is free, and
  28. this means that many users who would not want to pay for a full
  29. implementation will have access to this one.  Other users who may not
  30. be sure that they want pay for a full C implementation can use this
  31. one to determine if they like the language.
  32. :p.
  33. Another reason for the existence of Small-c is control:  You get all
  34. of the source for Small-c, and you can, if you wish, maintain or
  35. modify it yourself.  You can also change the I/O support package to
  36. suit your needs, and you can even port the compiler to a different
  37. processor if you wish (this version is converted from an 8080
  38. version).
  39. :h1.What can Small-c do?
  40. :p.
  41. Small-c takes a source file, consisting of C-subset statements, and
  42. creates an assembler source file.  This assembler source file can be
  43. processed by either the IBM Small Assembler or the IBM Macro Assembler
  44. to produce an IBM/Intel format OBJ file.  The OBJ file can, in turn,
  45. be combined with other OBJ files and LIB files via the DOS LINK
  46. function to produce an executable EXE module.  An I/O & utility
  47. function library is provided for this purpose, implementing an
  48. environment which quite closely mimics the UNIX environment.
  49. :p.
  50. This version of Small-c can be executed on an IBM PC with 128K of
  51. storage, one single-sided diskette drive, and running IBM DOS 1.1 or
  52. 2.0.  In all likelihood, the compiler will execute on a 96K system,
  53. but this has never been tried.  Since at least 96K is needed to run
  54. either of the assemblers, there is little merit in executing in less
  55. than 96K.  Although dual diskette drives are necessary for large
  56. compilations (where the assembler source can occupy most of one
  57. diskette), they are useful but not essential otherwise.  Where a hard
  58. file is available, this may be used in place of diskettes.  The
  59. compiler runs equally well on DOS 1.1 and DOS 2.0, although it does
  60. not utilize the increased function of DOS 2.0.  Release 1.01 has added
  61. up to 2 dimensional arrays of all supported data types (D. Lang 12/90)
  62. :p.
  63. Programs created with the compiler (and suitably assembled and linked)
  64. can be executed on any IBM DOS system with sufficient storage.
  65. Normally, the programs must be linked with the associated Small-c
  66. library which, in addition to providing I/O support, sets up the
  67. operating environment.  However, a reasonably adept programmer should
  68. be able to link Small-c procedures with procedures from other
  69. compilers, if necessary coding assembler "glue" via the the Small-c
  70. "#asm" statement.
  71. :p.
  72. Although it has never (to my knowledge) been attempted, there is no
  73. known reason why this version of Small-c (and the programs it
  74. compiles) should not execute equally well on any suitably configured
  75. IBM PC-compatible MS DOS system.
  76. :h1.What WON'T it do?
  77. :p.
  78. Small-c was originated by Ron Cain, and was originally published in
  79. Dr. Dobb's Journal, number 45.  The original intent was to provide
  80. users of small microprocessor systems with a compact yet powerful
  81. systems programming language, one which could be both used and
  82. maintained on a small system.  For this reason, many of the features
  83. of full C implementations were omitted, resulting in a restricted but
  84. usable language.  Small-c Version 2.0 was developed by J. E. Hendrix
  85. and published in Dr. Dobb's Journal, numbers 74 & 75.  This version,
  86. slightly larger to account for the tendency toward larger systems, has
  87. fewer restrictions and is considerably more powerful.  Nonetheless, it
  88. has significant restrictions relative to full C implementations.  The
  89. following are the principle restrictions:
  90. :ol.
  91. :li.Structures and unions are not supported.
  92. :li.Up to 2 dimensions arrays supported in Release 1.01
  93. :li.Floating point is not supported.
  94. :li."Long" integers are not supported.
  95. :li.Only functions returning integers are supported.
  96. :li.Pointers to pointers, arrays of pointers, and several of the other
  97. exotic forms of declarations are not supported.
  98. :eol.
  99. :h1.Running Small-c
  100. :p.
  101. The compiler may be invoked with the parameters specified on the
  102. command line, with prompting for the parameters, or a combination of
  103. the two.  To invoke the compiler with prompting, type:
  104. :sl.
  105. :li.CC
  106. :esl.
  107. :pc.The compiler will display the prompt:
  108. :sl.
  109. :li.Input file [CON.C]:
  110. :esl.
  111. :pc.Type in the name of the file containing your C program.  A
  112. filename extension of "C" is assumed.  If you enter no filename, input
  113. will be accepted from the keyboard.
  114. :p.The compiler will then display the prompt:
  115. :sl.
  116. :li.Output file [CON.ASM]:
  117. :esl.
  118. :p.
  119. Type in the file name of the file to contain the assembler source.  A
  120. filename identical to the source file name and an extension of "ASM"
  121. is assumed.
  122. :p.
  123. The compiler will then display the prompt:
  124. :sl.
  125. :li.Listing file [NUL.LST]:
  126. :esl.
  127. :p.
  128. Normally, the listing file is either suppressed (by routing to the NUL
  129. device) or is routed to the printer (by specifying "prn", for
  130. example).  If no filename is specified, NUL is assumed.
  131. :pc.
  132. The compiler then asks the following yes/no questions:
  133. :sl.
  134. :li.Interleave C source?
  135. :li.Monitor function headers?
  136. :li.Sound alarm on errors?
  137. :li.Pause on errors?
  138. :esl.
  139. :p.
  140. "Interleave C source" means to place the C source statements into the
  141. assembler source as comments.  This is very useful if the assembler
  142. source is to be examined or modified after compilation, but it
  143. increases the size of the assembler source file (by slightly more than
  144. the size of the C source file).
  145. :p.
  146. "Monitor function headers" means to display each function header (and
  147. include statement) as it is processed.  This is useful both for
  148. monitoring the progress of the compilation and for interpreting the
  149. context of error messages from the compiler.  This question is not
  150. asked (and function headers and include statements are not displayed)
  151. if output is being routed to the display screen.
  152. :p.
  153. "Sound alarm on errors" means to sound the PC's "bell" (beeper)
  154. whenever an error message is displayed (also, when the compilation
  155. ends).  This is useful for long compilations where one might wish to
  156. leave the computer unattended but be alerted when attention was
  157. needed.
  158. :p.
  159. "Pause on errors" means to stop after displaying each error message
  160. and wait for an "ENTER" before proceeding.  This prevents the error
  161. message from being scrolled off the screen before it can be examined.
  162. :p.
  163. After these questions have been answered, the compilation will begin.
  164. C source statements will be read from the input file and written to
  165. the output file.  Function headers and include statements will be
  166. displayed if selected.  When the compilation is finished, the
  167. following message is displayed (where n is a number):
  168. :sl.
  169. :li.There were n errors in this compilation
  170. :esl.
  171. :p.
  172. If the number of errors is zero (or if you are willing to accept
  173. whatever the errors are that have occurred), you may process the
  174. produced assembler source with ASM (IBM Small Assembler) or MASM (IBM
  175. Macro Assembler).  Once the program has been successfully compiled and
  176. assembled, it should be linked, using the DOS LINK program, with the
  177. CC.LIB library supplied, thereby producing the executable EXE file.
  178. :p.
  179. When parameters are specified via the DOS command line, the file names
  180. must be entered in order -- source file, assembler file, listi